var look = {
    refunddy: function() {
        var e = getApp(), a = [], o = e.globalData.htdy_message;
        return e.globalData.webset && "1" == e.globalData.webset.messagetype && [ "dy_mb_refund_success" ].forEach(function(e, t) {
            o[e] && a.push(o[e]);
        }), a;
    },
    groupdy: function() {
        var e = getApp(), a = [], o = e.globalData.htdy_message;
        return e.globalData.webset && "1" == e.globalData.webset.messagetype && [ "dy_mb_group_success", "dy_mb_deliver_sure", "dy_mb_club_delivery" ].forEach(function(e, t) {
            o[e] && a.push(o[e]);
        }), a;
    }
};

look.groupdy = function() {
    var e = getApp(), a = [], o = e.globalData.htdy_message;
    return e.globalData.webset && "1" == e.globalData.webset.messagetype && [ "dy_mb_group_success", "dy_mb_deliver_sure", "dy_mb_club_delivery" ].forEach(function(e, t) {
        o[e] && a.push(o[e]);
    }), a;
}, look.orderdy = function() {
    var e = getApp(), a = [], o = e.globalData.htdy_message;
    return e.globalData.webset && "1" == e.globalData.webset.messagetype && [ "dy_mb_deliver_sure", "dy_mb_club_delivery" ].forEach(function(e, t) {
        o[e] && a.push(o[e]);
    }), a;
}, look.requestSubscribeMessage = function(e, t) {
    var a = getApp(), o = wx.getSystemInfoSync().SDKVersion;
    0 <= a.util.compareVersion(o, " 2.8.2 ") && 0 < e.length ? wx.requestSubscribeMessage({
        tmplIds: e,
        success: function(e) {},
        complete: function(e) {
            "function" == typeof t && t({
                status: 1,
                ret: e
            });
        }
    }) : "function" == typeof t && t({
        status: 1
    });
}, look.toDecimal = function(e) {
    var t = parseFloat(e);
    if (!isNaN(t)) return t = Math.round(100 * e) / 100;
}, look.navbar = function(e) {
    var t = getApp().globalData.theme;
    null != t && 2 == t.theme_type && "" != t.navbar_bg && null != t.navbar_bg && null != t.navbar_bg && wx.setNavigationBarColor({
        frontColor: t.navbar_color,
        backgroundColor: t.navbar_bg,
        animation: {
            duration: 400,
            timingFunc: "easeIn"
        }
    });
}, look.no = function(e, t) {
    var a = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1500;
    wx.showToast({
        title: e,
        icon: "none",
        duration: a,
        image: "../../images/close.png",
        success: function() {
            "function" == typeof t && setTimeout(t, a);
        }
    });
}, look.alert = function(e) {
    wx.showToast({
        title: e,
        icon: "none"
    });
}, look.istrue = function(e) {
    return "" != e && null != e && "undefined" != e;
}, look.back = function(e) {
    wx.navigateBack({
        delta: e
    });
}, look.ok = function(e, t) {
    var a = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1500;
    wx.showToast({
        title: e,
        duration: a,
        success: function() {
            "function" == typeof t && setTimeout(t, a);
        }
    });
}, look.change_date = function(e) {
    return e.replace(/\-/g, "/");
}, look.getuserinfo = function(e, a) {
    var o = getApp();
    if ("getUserInfo:ok" != e.detail.errMsg) return o.getUserInfo = !1, void a.setData({
        getUserInfo: !1
    });
    o.util.getUserInfo(function(t) {
        if ("getUserInfo:ok" === e.detail.errMsg) {
            o.getUserInfo = !1, look.accredit(a);
            o.globalData.userInfo, t = t.wxInfo;
            o.util.request({
                url: "entry/wxapp/index",
                showLoading: !1,
                data: {
                    op: "changeuser",
                    nickname: t.nickName,
                    gender: t.gender,
                    avatar: t.avatarUrl
                },
                success: function(e) {
                    null == o.globalData.userInfo ? o.globalData.userInfo = {
                        niakname: t.nickName,
                        gender: t.gender,
                        avatarurl: t.avatarUrl
                    } : (o.globalData.userInfo.nickname = t.nickName, o.globalData.userInfo.gender = t.gender, 
                    o.globalData.userInfo.avatarurl = t.avatarUrl);
                }
            });
        }
    }, e.detail);
}, look.footer = function(e) {
    var t = getApp(), a = wx.getStorageSync("cars") || [], o = wx.getStorageSync("limitcars") || [];
    a && (t.tabBar.number = a.length + o.length), t.util.footer(e);
}, look.group_footer = function(e) {
    var t = e, a = getApp().group_tabBar;
    for (var o in a.list) a.list[o].pageUrl = a.list[o].pagePath.replace(/(\?|#)[^"]*/g, "");
    t.setData({
        tabBar: a,
        "tabBar.thisurl": t.__route__
    });
}, look.sport_footer = function(e) {
    var t = e, a = getApp().sport_tabBar;
    for (var o in a.list) a.list[o].pageUrl = a.list[o].pagePath.replace(/(\?|#)[^"]*/g, "");
    t.setData({
        tabBar: a,
        "tabBar.thisurl": t.__route__
    });
}, look.accredit = function(e) {
    var t = getApp(), a = e;
    null == t.accredit && (t.accredit = []), t.accredit.force = t.globalData.webset.force, 
    a.setData({
        getUserInfo: t.getUserInfo,
        accredit: t.accredit
    });
}, look.txvideo = function() {
    var t = requirePlugin("tencentvideo").getTxvContext("txv1");
    t.play(), t.pause(), t.requestFullScreen(), t.exitFullScreen(), t.playbackRate(+e.currentTarget.dataset.rate);
}, look.count_express = function(r, i, s, l) {
    var a = {}, e = getCurrentPages();
    e && (a = e[getCurrentPages().length - 1]), a.data.isexpress = !0;
    var u = 0, t = getApp();
    r = t.globalData.express;
    if (1 != t.globalData.webset.express || null == r) return u;
    l = l.split(" ");
    var c = !0;
    if ("" != r.notarea && null != r.notarea && "undefined" != r.notarea && c) {
        var o = r.notarea;
        for (var n in o) {
            if (!c) return;
            l[0] == n && o[n].forEach(function(e, t) {
                if (e == l[1]) return a.setData({
                    isexpress: !1
                }), void (c = !1);
            });
        }
    }
    c && "" != r.setting && null != r.setting && "undefined" != r.setting && r.setting.forEach(function(n, e) {
        if (c && "" != n.citys) {
            var t = n.citys;
            for (var a in t) {
                if (!c) return;
                a == l[0] && t[a].forEach(function(e, t) {
                    if (e == l[1]) {
                        var a = r.calculatetype, o = n.value;
                        return "weight" == a && (s <= o.firstweight && (u = parseFloat(o.firstprice)), s > o.firstweight && (u = parseFloat(o.firstprice) + Math.ceil((s - o.firstweight) / o.secondweight) * o.secondprice)), 
                        "number" == a && (i <= o.firstnum && (u = parseFloat(o.firstnumprice)), i > o.firstnum && (u = parseFloat(o.firstnumprice) + Math.ceil((i - o.firstnum) / o.secondnum) * o.secondnumprice)), 
                        void (c = !1);
                    }
                });
            }
        }
    });
    if (c && "" != r.default && null != r.default && "undefined" != r.default) {
        var f = r.default, d = r.calculatetype;
        "weight" == d && (s <= f.default_firstweight && (u = parseFloat(f.default_firstprice)), 
        s > f.default_firstweight && (u = parseFloat(f.default_firstprice) + Math.ceil((s - f.default_firstweight) / f.default_secondweight) * f.default_secondprice)), 
        "number" == d && (i <= f.default_firstnum && (u = parseFloat(f.default_firstnumprice)), 
        i > f.default_firstnum && (u = parseFloat(f.default_firstnumprice) + (i - f.default_firstnum) / f.default_secondnum * f.default_secondnumprice));
    }
    return u.toFixed(2);
}, look.updata = function(e) {
    console.log(e);
    var n = [];
    if (!look.istrue(e)) return console.info("look.updata:参数为空"), n;
    var r = getApp(), i = new r.util.date();
    return e.forEach(function(e, t) {
        var a = e.substring(e.lastIndexOf("."), e.length), o = "images/" + r.siteInfo.uniacid + "/" + i.dateToStr("yyyy") + i.dateToStr("/MM/") + r.util.md5("xc_xinguwu" + i.dateToLong(new Date()) + Math.random().toString(36).substr(2)) + a;
        n.push(o);
    }), e.forEach(function(e, t) {
        wx.uploadFile({
            url: r.siteInfo.siteroot + "?i=" + r.siteInfo.uniacid + "&c=entry&do=upload&m=xc_xinguwu",
            filePath: e,
            name: "file",
            formData: {
                filename: n[t]
            },
            success: function(e) {}
        });
    }), n;
}, look.updataone = function(e, t) {
    t || (t = 1);
    var a = "images/" + app.siteInfo.uniacid + "/" + date.dateToStr("yyyy") + date.dateToStr("/MM/") + app.util.md5("xc_xinguwu" + date.dateToLong(new Date()) + Math.random().toString(36).substr(2) + t) + type;
    return wx.uploadFile({
        url: app.siteInfo.siteroot + "?i=" + app.siteInfo.uniacid + "&c=entry&do=upload&m=xc_xinguwu",
        filePath: e,
        name: "file",
        formData: {
            filename: a
        },
        success: function(e) {}
    }), a;
}, look.floatIcon = function(e, t) {
    null == e.data.hiddenFloat && e.setData({
        hiddenFloat: !1
    }), null == e.scrollTop || (e.scrollTop > t.scrollTop && 1 == e.data.hiddenFloat ? e.setData({
        hiddenFloat: !1
    }) : e.scrollTop < t.scrollTop && 0 == e.data.hiddenFloat && e.setData({
        hiddenFloat: !0
    })), e.scrollTop = t.scrollTop;
}, look.goHome = function(t) {
    var a = getApp();
    console.log(a.systeminfo), null == a.goHome && (a.goHome = {
        left: 620,
        top: 750 / parseInt(a.systeminfo.screenWidth) * parseInt(a.systeminfo.screenHeight) - 360
    }), t.setData({
        goHome: a.goHome
    }), t.moveGoHome = function(e) {
        t.setData({
            "goHome.left": 750 / parseInt(a.systeminfo.screenWidth) * parseInt(e.touches[0].clientX),
            "goHome.top": 750 / parseInt(a.systeminfo.screenWidth) * parseInt(e.touches[0].clientY)
        });
    };
}, module.exports = look;